//
//  JGTouchEvent.h
//  JGGameController
//
//  Created by jagger.tu on 2024/12/25.
//

#import <Foundation/Foundation.h>
#import <JGVividEngine/JGControlEvent.h>

typedef NS_ENUM(NSInteger,JGTouchEventType) {
    JGTouchEventBegin = 0x08,
    JGTouchEventEnded = 0x09,
    JGTouchEventMove = 0x0A,
    JGTouchEventCancel = 0x0B
};

typedef NS_ENUM(NSInteger,JGTouchMode) {
    JGTouchModeDelta = 0x06,
    JGTouchModeAbsolutely = 0x09,
};

NS_ASSUME_NONNULL_BEGIN

/// 游戏触控事件
@interface JGTouchEvent : JGControlEvent

@property (nonatomic, assign) JGTouchMode mode;
@property (nonatomic, assign) NSInteger index;
@property (nonatomic, assign) JGTouchEventType action;
/// 当前坐标x
@property (nonatomic, assign) float x;
/// 当前坐标y
@property (nonatomic, assign) float y;
/// 相对上次偏移坐标x
@property (nonatomic, assign) float dx;
/// 相对上次偏移坐标y
@property (nonatomic, assign) float dy;

/// 所在坐标系或视图的宽度
@property (nonatomic, assign) float width;
/// 所在坐标系或视图的高度
@property (nonatomic, assign) float height;

@property (nonatomic, assign, readonly) float sx;
@property (nonatomic, assign, readonly) float sy;


/// 绝对坐标的触控事件
/// - Parameters:
///   - point: 所在视图坐标系的坐标点
///   - area: 所在视图的区域
///   - index: 触控下标
///   - action: 触控 开始 移动 结束 取消
- (instancetype)initWithLocalPoint:(CGPoint)point area:(CGSize)area index:(NSInteger)index action:(JGTouchEventType)action;

@end

/// 游戏触控事件
@interface JGPassThroughTouchEvent : JGControlEvent

@property (nonatomic, assign) JGTouchMode mode;
@property (nonatomic, assign) NSInteger index;
@property (nonatomic, assign) JGTouchEventType action;
/// 当前坐标x
@property (nonatomic, assign) uint16_t x;
/// 当前坐标y
@property (nonatomic, assign) uint16_t y;

@end

NS_ASSUME_NONNULL_END
